import {connect} from 'react-redux'
import {changeTextAction, buttonClickAction} from '../actions/index.js'
import RudexDemo from '../component/RudexDemo.js'

//映射Redux state到组件的属性
const mapStateToProps = state => ({
    text: state.text,
})

//映射Redux actions到组件的属性
const mapDispatchToProps = dispatch => ({
    onButtonClick: () => dispatch(buttonClickAction),
    onChangeText: num => () => dispatch(changeTextAction(num)),
})

//连接组件
export default connect(mapStateToProps, mapDispatchToProps)(RudexDemo)